package lambda;

import com.alibaba.druid.support.json.JSONUtils;

public class LambdaSmple {
    public static void main(String[] args) {
        //标准使用方式
        MathOperation addition = (Integer a, Integer b) -> {
            System.out.println("加法运算");
            return a + b + 0f;//0f是转化未float型
        };
        System.out.println(addition.operate(5, 3));

        //Lambda运行忽略参数类型
        MathOperation subtraction = ( a,  b) -> {
            System.out.println("减法运算");
            return a - b + 0f;
        };
        System.out.println(subtraction.operate(5,3));

        System.out.println("");
        //单行代码实现 可省略大括号和return
        MathOperation multiplication = (a, b) -> a * b + 0f;
        System.out.println(multiplication.operate(5,3));
    }
}
